package com.vzaar;

/**
 * Video embed request object. This request object allows for 
 * configuring the request.
 * 
 * @author Marc G. Smith
 */
public class VideoDetailsRequest extends VzaarRequest 
{
	///////////////////////////////////////////////////////////////////////////
	// Public Static Methods //////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////////
	
	/**
	 * Create a request object configured to request the full details of the 
	 * object.
	 * 
	 * @param videoId the video number for the video
	 * @return a video detail request for full details
	 */
	public static VideoDetailsRequest fullDetails(int videoId) {
		VideoDetailsRequest request = new VideoDetailsRequest(videoId);
		request.setDescription(true);
		request.setDuration(true);
		request.setEmbedOnly(false);
		request.setFramegrab(true);
		request.setThumbnail(true);
		return request;
	}

	///////////////////////////////////////////////////////////////////////////

	/**
	 * Create a request object configured to request the minimal details for
	 * embedding.
	 * 
	 * @param videoId the video number for the video
	 * @return a video detail request for the minimal details
	 */
	public static VideoDetailsRequest embedOnly(int videoId) {
		VideoDetailsRequest request = new VideoDetailsRequest(videoId);
		request.setEmbedOnly(true);
		return request;
	}
	
	///////////////////////////////////////////////////////////////////////////
	// Request Parameter Names ////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////////

	protected static final String MAX_WIDTH = "maxwidth";
	protected static final String MAX_HEIGHT = "maxheight";
	protected static final String BORDERLESS = "borderless";
	protected static final String THUMBNAIL = "thumbnail";
	protected static final String FRAMEGRAB = "framegrab";
	protected static final String EMBED_ONLY = "embed_only";
	protected static final String DURATION = "duration";
	protected static final String DESCRIPTION = "description";
	
	///////////////////////////////////////////////////////////////////////////
	// Private Members ////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////////
	
	private int videoId;
	
	///////////////////////////////////////////////////////////////////////////
	// Public Methods /////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////////

	/**
	 * Construct a video details request for the given video id. This object 
	 * can be reused for different videos by calling setVideoId(). It is
	 * not thread safe obviously.
	 * 
	 * @param videoId the video number for the video
	 */
	public VideoDetailsRequest(int videoId) {
		this.videoId = videoId;
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * The video number for the video.
	 * 
	 * @return the video number for the video
	 */
	public int getVideoId() {
		return videoId;
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * The video number for the video.
     *
	 * @param videoId the video number for the video
	 */
	public void setVideoId(int videoId) {
		this.videoId = videoId;
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * The maximum width of the video. Returns the closest smaller size 
	 * available when if not possible. Defaults to original size.
	 * 
	 * @return the maximum width of the video
	 */
	public Integer getMaxWidth() {
		return getInteger(MAX_WIDTH);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * The maximum width of the video. Returns the closest smaller size 
	 * available when if not possible. Defaults to original size.
	 * 
	 * @param maxWidth the maximum width of the video
	 */
	public void setMaxWidth(Integer maxWidth) {
		putParameter(MAX_WIDTH, maxWidth);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * The maximum height of the video. Returns the closest smaller size 
	 * available when if not possible. Defaults to original size.
	 * 
	 * @return the maximum height of the video
	 */
	public Integer getMaxHeight() {
		return getInteger(MAX_HEIGHT);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * The maximum height of the video. Returns the closest smaller size 
	 * available when if not possible. Defaults to original size.
	 * 
	 * @param maxHeight the maximum height of the video
	 */
	public void setMaxHeight(Integer maxHeight) {
		putParameter(MAX_HEIGHT, maxHeight);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * If set to true and the user has sufficient privileges, the size and 
	 * embedded code returned will be be for a borderless player. Else ignored.
     *
	 * @return should return borderless player embed code
	 */
	public Boolean getBorderless() {
		return getBoolean(BORDERLESS);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * If set to true and the user has sufficient privileges, the size and 
	 * embedded code returned will be be for a borderless player. Else ignored.
     *
	 * @param borderless should return borderless player embed code
	 */
	public void setBorderless(Boolean borderless) {
		putParameter(BORDERLESS, borderless);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * When returning data include information about the video thumbnail.
	 * 
	 * @return should return video thumbnail information
	 */
	public Boolean getThumbnail() {
		return getBoolean(THUMBNAIL);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * When returning data include information about the video thumbnail.
	 * 
	 * @param thumbnail should return video thumbnail information
	 */
	public void setThumbnail(Boolean thumbnail) {
		putParameter(THUMBNAIL, thumbnail);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * When returning data include information about the video frame grab.
	 * 
	 * @return should return video frame grab information
	 */
	public Boolean getFramegrab() {
		return getBoolean(FRAMEGRAB);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * When returning data include information about the video frame grab.
	 * 
	 * @param framegrab should return video frame grab information
	 */
	public void setFramegrab(Boolean framegrab) {
		putParameter(FRAMEGRAB, framegrab);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * When returning data, only include the minimum fields and embed code 
	 * possible. Use this if you want the quickest and smallest return code for 
	 * embedding in it.
	 * 
	 * @return should return minum fields and embed code
	 */
	public Boolean getEmbedOnly() {
		return getBoolean(EMBED_ONLY);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * When returning data, only include the minimum fields and embed code 
	 * possible. Use this if you want the quickest and smallest return code for 
	 * embedding in it.
	 * 
	 * @param embedOnly should return minum fields and embed code
	 */
	public void setEmbedOnly(Boolean embedOnly) {
		putParameter(EMBED_ONLY, embedOnly);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * Include (or not) duration of a video. Defaults to false.
	 * 
	 * @return should include duration of video
	 */
	public Boolean getDuration() {
		return getBoolean(DURATION);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * Include (or not) duration of a video. Defaults to false.
	 * 
	 * param duration should include duration of video
	 */
	public void setDuration(Boolean duration) {
		putParameter(DURATION, duration);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * Include (or not) description of a video. Defaults to false.
	 * 
	 * @return should include description of video
	 */
	public Boolean getDescription() {
		return getBoolean(DESCRIPTION);
	}
	
	///////////////////////////////////////////////////////////////////////////

	/**
	 * Include (or not) description of a video. Defaults to false.
	 * 
	 * @param description should include description of video
	 */
	public void setDescription(Boolean description) {
		putParameter(DESCRIPTION, description);
	}
	
	///////////////////////////////////////////////////////////////////////////
}
